﻿@{
    ViewBag.Title = "Index";
    ViewBag.HideSideBar = true;
    ViewBag.DateTimePattern = System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortTimePattern + " " + System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern;
}

@section HtmlHead {
    <style type="text/css">
    
    .home-main, .home-side { float: left; }
    .home-main { width: 600px; }
    .home-side { width: 400px; }
    
    .news-item { margin: 10px 0; }
    .news-item .news-date { display: inline; }
    .news-item h4 { margin: 0; display: inline; }
    
    .form-field label { display: block; margin: 5px 0; }
    .form-field textarea { width: 535px; height: 50px; }
    .field-17734ff6tf0d0 { float: left; }
    .field-validation { color: red; }
    .form-send { float: right; margin-top: 30px !important; }
    
    .forum-data { margin-top: 15px; }
    .forum-item { margin-top: 10px; padding: 10px 2px 0 2px; }
    .forum-item-message { margin-top: 2px; }
    
    </style>

    <script src="@Url.Content("~/Javascript/jquery.jsonp-2.3.0.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Javascript/Forms.IO.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Javascript/Forms.UI.js")" type="text/javascript"></script>
}

@section JavascriptDomReady {
    
    var formID = '@Loc("66e9da18r5d92")';
    
    var renderer = new Forms.UI.DataRenderer(formID)
        .SetParent('#forum-data')
        .SetDateTimeFormat('@ViewBag.DateTimePattern')
        .SetItemTemplate('<div class="folder-separator forum-item"><strong>{17734ff6tf0d0}</strong> (@Loc("at") {created}) @Loc("said")<div class="forum-item-message">{27460bddaaddd}</div></div>')
        .Render();

    var builder = new Forms.UI.FormBuilder(formID)
        .SetParent('#forum-form')
        .SetMetaData({
            'Fields': {
                '27460bddaaddd' : {
                    RenderAs: 'textarea'
                },
                '17734ff6tf0d0' : {
                    DefaultValue: '@(UserContext.IsAuthenticated() ? UserContext.Account.Fullname : "")'
                }
            }
        })
        .SetSavedHandler(function (item) {
            if (renderer != null) {
                renderer.SetData(item.concat(renderer.GetData()));
                renderer.ReRender();
            }
            this.Clear();
        })
        .CreateSendButton('@Loc("Send message")')
        .Build();

}

<div class="home-main">
    @Html.Action("IndexWelcome")

    <div class="folder">
        <h2 class="folder-heading">@Loc("Mini-forum")</h2>

        <div id="forum-form"></div>
        <div class="clear"></div>
        <div id="forum-data" class="forum-data"></div>
    </div>
</div>
<div class="home-side">
    @Html.Action("QuickNews")
</div>
<div class="clear"></div>